#ifndef TRIANGLE_H
#define TRAINGLE_H

#include "Geometry.h"

class WTriangle: public Geometry {
public:
    vec3 p1, p2, p3;
    vec3 normal;

    WTriangle() {
        name = "Triangle";
    }

    Symbol parse(ifstream &file, Symbol curToken);
    bool intersect(Ray *r);
    vec3 getNormal(Ray *r);
    vec3 genRandomPoint(vec3 look, int cur, int lim);

    void print() {
        printf("Triangle:\n\tCorner 1: %f %f %f\n\tCorner 2: %f %f %f"
                "\n\tCorner3: %f %f %f\n",
                p1.x, p1.y, p1.z,
                p2.x, p2.y, p2.z,
                p3.x, p3.y, p3.z);

        Geometry::print();
    }

    AABB *generateAABB();

    int type() {
        return 3;
    }
};

#endif
